﻿using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Tools.Ribbon;

namespace VSTODemo {
    public partial class Ribbon1 {
        private Application excelApp;

        private void Ribbon1_Load(object sender, RibbonUIEventArgs e) {
            excelApp = Globals.ThisAddIn.Application;
        }

        private void btnImport_Click(object sender, RibbonControlEventArgs e) {
            System.Data.DataTable employees = EmployeeService.ListAll();

            Worksheet activeSheet = excelApp.ActiveSheet;
            ExcelUtils.CopyFromDataTable(employees, activeSheet);
        }
    }
}
